package com.isoftstone.app.controller.appDept;

import com.isoftstone.bank.controller.base.BaseController;
import com.isoftstone.common.Tidings;
import com.isoftstone.merchant.entity.mdept.MDept;
import com.isoftstone.merchant.service.mdept.impl.MdeptService;
import com.isoftstone.util.Const;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author: zhaojg
 * @Description
 * @Date: Created in 13:59 2017/12/12
 * @Modified by:
 *
 * 手机端缴费单位下缴费机构树查询
 */
@Controller
public class AppDeptTreeController extends BaseController{

    @Autowired
    MdeptService mdeptService;

    /**
     * 根据缴费单位id查询出下面所有的缴费机构
     * @param corpId 缴费单位id
     * @return
     */
    @RequestMapping(value = "app/admin/queryAllDetp",method = RequestMethod.POST)
    @ResponseBody
    public Object queryAllDetp(String corpId ){
        Tidings<Object> tidings = new Tidings<Object>();
        try {
            List<MDept> deptAll = mdeptService.getDownDeptAll(corpId);
            tidings.setMsg("查询成功");
            tidings.setStatus(Const.SUCCESS);
            tidings.setT(deptAll);
        } catch (Exception e) {
            tidings.setMsg("查询失败");
            tidings.setStatus(Const.ERROR);
            e.printStackTrace();
        }
        return tidings;

    }





}
